#!/bin/bash
###
# @Author: apophis
# @File: sqoop.sh
# @Time: 2025/1/22 17:29
# @Description: 工程描述
###
now=$(date +"%Y-%m-%d %H:%M:%S")
# yesterday=$(date -d "-1 day ${now}" "+%Y-%m-%d")
cd "$(dirname "$0")" || exit
filepath=$(pwd)
echo "当前时间: ${now} *** 进入 ${filepath} 目录"
# here put the import lib
TABLES=(
    'account'
    'borrow'
    'dormitory'
    'dormitory_account'
    'pay'
    'repair'
    'role'
    'tower'
)

for TABLE in "${TABLES[@]}"
do
   /export/software/sqoop-1.4.7.bin__hadoop-2.6.0/bin/sqoop export \
   --connect jdbc:mysql://master:3306/dormitory?characterEncoding=utf-8 \
   --username root \
   --password 123456 \
   --table ${TABLE} \
   --export-dir /data/output/${TABLE} \
   --input-null-non-string '\\N' \
   --input-null-string '\\N' \
   -m 4 \
   --fields-terminated-by '\0001'
done


